/* manager merchant service*/

var constant = require('../config/constant.config');
merchantService.$inject = ['$http'];
function merchantService($http){
    var url = constant.CONTEXT_PATH+'/sec/merchants';

    function findMerchantByStatus(status){
        return $http.get(url+'/status/'+status);
    }

    function updateStatus(status,mid){
        var body = {
            id:mid,
            status:status
        }
        return $http.put(url+'/status',body);
    }

    function updateBan(ban,mid){
        var body = {
            id:mid,
            ban:ban
        }
        return $http.put(url+'/ban',body);
    }



    function updateMerchant(merchant){
        return $http.put(url,merchant);
    }

    function test(){
        console.log('33333');
    }
    return {
        test:test,
        findMerchantByStatus:findMerchantByStatus,
        updateStatus:updateStatus,
        updateBan:updateBan,
        updateMerchant:updateMerchant
    }
}

module.exports = merchantService;